﻿
<Serializable()>
Public Class QueryOptions
    Private Shared mDefaultOptions As QueryOptions
    Public Shared ReadOnly Property DefaultOptions As QueryOptions
        Get
            Return mDefaultOptions
        End Get
    End Property

    Shared Sub New()
        mDefaultOptions = New QueryOptions
        mDefaultOptions.Reset()
    End Sub

    Public Sub New()
        Reset()
    End Sub

    Public Property CompressSpaces As Boolean
    Public Property AlwaysWrapGroups As Boolean
    Public Property TerminateQuery As Boolean

    Private mDatabaseType As DatabaseType
    Public Property DatabaseType() As DatabaseType
        Get
            Return mDatabaseType
        End Get
        Set(ByVal value As DatabaseType)
            If value <> QBuilder.DatabaseType.MicrosoftSqlServer Then
                Throw New ArgumentException("Only MicrosoftSqlServer is supported at this time.")
            End If

            mDatabaseType = value
        End Set
    End Property

    Public Sub Reset()
        SetDefaults(Me)
    End Sub

    Private Shared Sub SetDefaults(ByRef Options As QueryOptions)
        Options.CompressSpaces = False
        Options.AlwaysWrapGroups = False
        Options.DatabaseType = DatabaseType.MicrosoftSqlServer
        Options.TerminateQuery = False
    End Sub

End Class

Public Enum DatabaseType As Integer
    MicrosoftSqlServer
    Access
    MySQL
    PostgreSQL
    Oricle
End Enum